<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../core/include.inc.jsp"%>

<form id="pagerForm" method="post" action="nvoice_list">
    <input type="hidden" name="pageNum" value="${pageModel.pageNum}" />
    <input type="hidden" name="numPerPage" value="${pageModel.numPerPage}" />
    <input type="hidden" name="blockName" value="${voiceInfo.blockName}" />
    <input type="hidden" name="status" value="${voiceInfo.status}" />
    <input type="hidden" name="accountNum" value="${voiceInfo.accountNum}" />
</form>

<form onsubmit="return navTabSearch(this);" action="nvoice_list" method="post">
    <div class="pageHeader">
        <div class="searchBar">
            <ul class="searchContent">
                <li>
                    <label>小区名称：</label>
                    <input type="text" name="blockName" value="${voiceInfo.blockName}" class="textInput" />
                </li>
                <li>
                    <label>状态：</label>
                    <select class="combox" name="status">
                        <option value="">全部</option>
                        <option value="已处理" <c:if test="${voiceInfo.status=='已处理'}">selected</c:if>>已处理</option>
                        <option value="未处理" <c:if test="${voiceInfo.status=='未处理'}">selected</c:if>>未处理</option>
                    </select>
                </li>
                <li>
                    <label>账号：</label>
                    <input type="text" name="accountNum" value="${voiceInfo.accountNum}" class="textInput" />
                </li>
            </ul>
            <div class="subBar">
                <ul>
                    <li><div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div></li>
                </ul>
            </div>
        </div>
    </div>
    <div class="pageContent">
        <div class="panelBar">
            <ul class="toolBar">
                <li><a style="display: none;" class="edit voice-edit" href="nto_voice_Edit?id={item_id}" target="dialog"
                       width="850" height="600" mask="true"><span>回复</span></a></li>
                <li><a class="edit" onclick="checkVoiceReply()"><span>回复</span></a></li>
                <li class="line">line</li>
                <li><a style="display: none;" class="edit voice-reply" href="nto_voice_reply?id={item_id}" target="navTab"><span>查看回复</span></a></li>
                <li><a class="edit" onclick="checkReply()"><span>查看回复</span></a></li>
                <li class="line">line</li>
            </ul>
        </div>
        <table class="table" width="100%" layoutH="137" style="table-layout: fixed">
            <thead>
            <tr>
                <th>序号</th>
                <th>物业/社区名称</th>
                <th>小区名称</th>
                <th>用户账号</th>
                <th>内容</th>
                <th>状态</th>
                <th>图片</th>
                <th>备注</th>
                <th>创建时间</th>
            </tr>
            </thead>
            <tbody class="voice-tb-body">
            <c:forEach var="item" items="${list}" varStatus="st">
                <tr target="item_id" rel="${item.id}" ondblclick="tableclick()" conStatus="${item.status}">
                    <td>${st.index+1}</td>
                    <td>${workNo}</td>
                    <td>${item.blockName}</td>
                    <td>${item.accountNum}</td>
                    <td><div STYLE="text-overflow:ellipsis;white-space:nowrap;overflow: hidden;">${item.content}</div></td>
                    <td>${item.status}</td>
                    <td>
                        <c:if test="${item.imgs[0]!=null}">
                            <a href="${item.imgs[0]}" target="navTab">点击查看</a>
                        </c:if>
                    </td>
                   <%-- <td><img STYLE="width: 30px" src="${item.imgs[0]}"></td>--%>
                    <td>${item.remark}</td>
                    <td>
                        <fmt:formatDate value="${item.createTime}" pattern="yyyy-MM-dd"/>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>

        <c:import url="../core/pagebar.inc.jsp" />

    </div>
</form>

<script>
    function checkVoiceReply() {
        var m = "";
        $(".voice-tb-body").find("tr").each(function(i,j){
            if( $(j).hasClass( "selected" ) ){
                m += "1";
                if( $(j).attr("conStatus") == '已处理' ){
                    alertMsg.info('您已经回复过了！');
                    return;
                }
                $(".voice-edit").click();
                return;
            }
        })
        if( m == ""  ){
            alertMsg.info('请选择一条记录！');
        }
    }

    function checkReply() {
        var m = "";
        $(".voice-tb-body").find("tr").each(function(i,j){
            if( $(j).hasClass( "selected" ) ){
                m += "1";
                if( $(j).attr("conStatus") == '未处理' ){
                    alertMsg.info('请先回复！');
                    return;
                }
                $(".voice-reply").click();
                return;
            }
        })
        if( m == ""  ){
            alertMsg.info('请选择一条记录！');
        }
    }
</script>